/*
 * Created by JFormDesigner on Fri May 24 11:00:57 CST 2024
 */

package sy7_1;

import java.awt.*;
import java.awt.event.*;
import javax.naming.Name;
import javax.swing.*;

/**
 * @author ASUS
 */
public class student extends JFrame {
    public student() {
        initComponents();
    }

    private void 注册(ActionEvent e) {
        // TODO add your code here
        String massage="学生信息： ";
        String name=name1.getText();
        massage+="我的名字是"+name+",";
        String age=age1.getText();
        massage+=age+",";
        if (boy.isSelected()){
            massage+=boy.getText()+",";
        }
        if (girl.isSelected()){
            massage+=girl.getText()+",";
        }
        if (like1.isSelected()){
            massage+=like1.getText()+",";
        }
        if (like2.isSelected()){
            massage+=like2.getText()+",";
        }
        if (like3.isSelected()){
            massage+=like3.getText()+",";
        }
        String introduce1=introduce.getText();
        massage+=introduce1+";";
        JOptionPane.showMessageDialog(null,massage);
    }

    private void button1(ActionEvent e) {
        // TODO add your code here
    }

    private void 重置(ActionEvent e) {
        // TODO add your code here
        name1.setText("");
        age1.setText("");
        boy.setSelected(true);
        like1.setSelected(false);
        like2.setSelected(false);
        like3.setSelected(false);
        introduce.setText("");
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        // Generated using JFormDesigner Open Source Project license - 淘宝星河飘雪
        label1 = new JLabel();
        label2 = new JLabel();
        label3 = new JLabel();
        name1 = new JTextField();
        age1 = new JTextField();
        boy = new JRadioButton();
        girl = new JRadioButton();
        label4 = new JLabel();
        like1 = new JCheckBox();
        like2 = new JCheckBox();
        like3 = new JCheckBox();
        label5 = new JLabel();
        button1 = new JButton();
        button2 = new JButton();
        scrollPane1 = new JScrollPane();
        introduce = new JTextArea();

        //======== this ========
        setTitle("\u5b66\u751f\u6ce8\u518c");
        var contentPane = getContentPane();
        contentPane.setLayout(null);

        //---- label1 ----
        label1.setText("\u59d3\u540d\uff1a");
        contentPane.add(label1);
        label1.setBounds(5, 10, 55, 30);

        //---- label2 ----
        label2.setText("\u5e74\u9f84\uff1a");
        contentPane.add(label2);
        label2.setBounds(5, 40, 55, 30);

        //---- label3 ----
        label3.setText("\u6027\u522b\uff1a");
        contentPane.add(label3);
        label3.setBounds(5, 75, 55, 30);
        contentPane.add(name1);
        name1.setBounds(75, 15, 170, name1.getPreferredSize().height);
        contentPane.add(age1);
        age1.setBounds(75, 45, 170, 24);

        //---- boy ----
        boy.setText("\u7537");
        contentPane.add(boy);
        boy.setBounds(new Rectangle(new Point(75, 80), boy.getPreferredSize()));

        //---- girl ----
        girl.setText("\u5973");
        contentPane.add(girl);
        girl.setBounds(new Rectangle(new Point(145, 80), girl.getPreferredSize()));

        //---- label4 ----
        label4.setText("\u64c5\u957f\uff1a");
        contentPane.add(label4);
        label4.setBounds(5, 110, 55, 30);

        //---- like1 ----
        like1.setText("java");
        contentPane.add(like1);
        like1.setBounds(new Rectangle(new Point(80, 116), like1.getPreferredSize()));

        //---- like2 ----
        like2.setText("c++");
        contentPane.add(like2);
        like2.setBounds(140, 120, 50, 19);

        //---- like3 ----
        like3.setText("c#");
        contentPane.add(like3);
        like3.setBounds(205, 120, 50, 19);

        //---- label5 ----
        label5.setText("\u81ea\u6211\u4ecb\u7ecd\uff1a");
        contentPane.add(label5);
        label5.setBounds(5, 155, 70, 30);

        //---- button1 ----
        button1.setText("\u6ce8\u518c");
        button1.addActionListener(e -> {
			注册(e);
			button1(e);
			button1(e);
		});
        contentPane.add(button1);
        button1.setBounds(15, 240, 80, button1.getPreferredSize().height);

        //---- button2 ----
        button2.setText("\u91cd\u7f6e");
        button2.addActionListener(e -> 重置(e));
        contentPane.add(button2);
        button2.setBounds(220, 240, 80, 24);

        //======== scrollPane1 ========
        {
            scrollPane1.setViewportView(introduce);
        }
        contentPane.add(scrollPane1);
        scrollPane1.setBounds(75, 165, 195, 65);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < contentPane.getComponentCount(); i++) {
                Rectangle bounds = contentPane.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = contentPane.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            contentPane.setMinimumSize(preferredSize);
            contentPane.setPreferredSize(preferredSize);
        }
        pack();
        setLocationRelativeTo(getOwner());

        //---- buttonGroup1 ----
        var buttonGroup1 = new ButtonGroup();
        buttonGroup1.add(boy);
        buttonGroup1.add(girl);
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    // Generated using JFormDesigner Open Source Project license - 淘宝星河飘雪
    private JLabel label1;
    private JLabel label2;
    private JLabel label3;
    private JTextField name1;
    private JTextField age1;
    private JRadioButton boy;
    private JRadioButton girl;
    private JLabel label4;
    private JCheckBox like1;
    private JCheckBox like2;
    private JCheckBox like3;
    private JLabel label5;
    private JButton button1;
    private JButton button2;
    private JScrollPane scrollPane1;
    private JTextArea introduce;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
